package com.cctc.mychat.client.command.impl;

import com.cctc.mychat.client.command.Command;
import com.cctc.mychat.common.protocol.message.impl.request.LoginRequestMessage;
import io.netty.channel.Channel;

import java.util.Scanner;

public class LoginCommand extends AbstractCommand {
    @Override
    public void run(Scanner scanner, Channel channel) {
        System.out.print("--> 请输入用户名：");
        String userName = scanner.next();
        System.out.print("--> 请输入密码：");
        String password = scanner.next();

        LoginRequestMessage request = LoginRequestMessage
                .builder()
                .userName(userName)
                .password(password)
                .build();
        channel.writeAndFlush(request);
    }

}
